<template>
  <div>
    <!-- 现金流量表提报 -->
    <TopFilter :list="topFilterList" :cols="3" @filterChange="changeHandle" @resetChange="resetChange" @onCollapse="collapseHandle"></TopFilter>

    <Spin :spinning="exportLoading" tip="Loading...">
      <FilterTable
        ref="table"
        columnsRef="qjhCashFlowReportSubmit"
        :height="'auto'"
        :isToperInfo="false"
        :isColumnFilter="false"
        :isSelectColumn="false"
        :columns="columns"
        :dataSource="tableList"
        :cellstyles="cellstyles"
        :onSyncTableData="tableChangeFun"
        :onColumnsChange="columns => (this.columns = columns)"
      >
        <template slot="controls">
            <el-button size="small" type="text" style="font-size:14px; font-weight:bold;margin-right:20px;color:red;width: calc(100vw - 420px);text-align: left;">
             <span v-text="`当前状态：${this.currStatus}`"></span>
           </el-button>
           
          <el-button size="small" type="primary" @click="importHandle">导 入</el-button>
          <multiuse-button size="small" type="primary" :disabled="!reportId" :click="exportHandle">导 出</multiuse-button>
        </template>
      </FilterTable>
      <div style="height:30px;"></div>
      <FormPanel ref="formPanel" :list="formList" @formChange="formChangeHandle" :isSubmitBtn="false" :collapse="false" />
      <div
        :style="{
          zIndex: 9,
          borderTop: '1px solid #e9e9e9',
          padding: '10px 20px',
          background: '#fff',
          textAlign: 'center'
        }"
      >
        <multiuse-button size="small" type="primary" v-show="isShow" :click="dataHandle.bind(this, 60801002)">提 交</multiuse-button>
        <multiuse-button size="small" type="primary" v-show="isShow" :click="dataHandle.bind(this, 60801001)">保 存</multiuse-button>
      </div>
    </Spin>

    <BaseDialog :visible.sync="isImport" title="数据导入" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <ImportFile :importData="formData" @close="emitCloseHandler" />
    </BaseDialog>
  </div>
</template>
<script>
import moment from 'moment';
import { getOwnerCode } from '@/assets/js/auth';
import { dictionary } from '@/utils/dictMixin';
import { exportExcelFile } from '@/utils/index';
import { queryList, exportExcel, saveOne } from '@/api/dealerFinance/CRReportManage/CashFlowReportSubmit';
import { getLoginUser } from '@/api/cms-api/projectOperating/program/departmentInquire'; //获取登录信息
import ImportFile from '../ImportFile';

export default {
  name: 'CashFlowReportSubmit',
  mixins: [dictionary],
  components: {
    ImportFile
  },
  data() {
    this.BaseTable = null;
    this.saveData = null;
    this.conf = { add: '新增', edit: '编辑', show: '明细' };

    return {
      topFilterList: this.createdFrom(),
      columns: this.createdTable(),
      formList: this.createdFrom1(),
      dealerName: '',
      exportLoading: false,
      isImport: false,
      isShow: true,
      formData: {},
      tableList: [],
      cellstyles: [],
      reportId: '',
      year: moment().format('YYYY'),
      month: moment().format('MM'),
      currStatus:'',
    };
  },
  created() {
    this.getDealerName();
    this.getList(moment().format('YYYY'), moment().format('MM'));
  },
  mounted() {
    this.BaseTable = this.$refs.table.$refs.pageTable;
  },

  methods: {
    // 获取登录信息
    async getDealerName() {
      const res = await getLoginUser();
      if (res.resultCode == 200) {
        this.dealerName = res.data.dealerName;
      }
    },
    tableChangeFun(val) {
      console.log(val, '---表格---');
      if (val && val.length > 0) {
        // 设置不可编辑-行列
        let arr = [];
        let arr1 = [];
        let [sumL1, sumR1, sumL2, sumR2, sumL3, sumR3, sumL4, sumR4, sumL5, sumR5, sumL6, sumR6] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        // 强转数字、设置置灰列；
        // this.cellstyles = [];
        val.map((x, index) => {
          // if (x.checkStatus == 10041002) {
          //   this.cellstyles.push({ row: x, dataIndex: 'column4', styles: { backgroundColor: 'red' } });
          // }
          arr.push(x);
          if ([0, 1, 2, 6, 11, 12, 13, 19, 24, 25, 26, 30, 34, 35, 37, 39].includes(index)) {
            arr1.push(x);
          }
          if (index > 1) {
            if (index == 2 || index == 13 || index == 26) {
              x.column3 = ' ';
              x.column4 = ' ';
              return;
            }
          }

          if (index > 2 && index < 6) {
            sumL1 += x.column3 * 10000;
            sumR1 += x.column4 * 10000;
          }
          if (index > 6 && index < 11) {
            sumL2 += x.column3 * 10000;
            sumR2 += x.column4 * 10000;
          }
          if (index > 13 && index < 19) {
            sumL3 += x.column3 * 10000;
            sumR3 += x.column4 * 10000;
          }
          if (index > 19 && index < 24) {
            sumL4 += x.column3 * 10000;
            sumR4 += x.column4 * 10000;
          }
          if (index > 26 && index < 30) {
            sumL5 += x.column3 * 10000;
            sumR5 += x.column4 * 10000;
          }
          if (index > 30 && index < 34) {
            sumL6 += x.column3 * 10000;
            sumR6 += x.column4 * 10000;
          }
        });
        this.BaseTable.SET_CELL_UNEDITABLE(arr, 'column1', true);
        this.BaseTable.SET_CELL_UNEDITABLE(arr, 'column2', true);
        this.BaseTable.SET_CELL_UNEDITABLE(arr1, 'column3', true);
        this.BaseTable.SET_CELL_UNEDITABLE(arr1, 'column4', true);

        // 经营活动现金流入小计 4=1+2+3
        val[6].column3 = sumL1 / 10000;
        val[6].column4 = sumR1 / 10000;
        // 经营活动现金流出小计 9=5+6+7+8
        val[11].column3 = sumL2 / 10000;
        val[11].column4 = sumR2 / 10000;
        // 经营活动产生的现金流量净额 10=4-9
        val[12].column3 = (sumL1 - sumL2) / 10000;
        val[12].column4 = (sumR1 - sumR2) / 10000;
        // 投资活动现金流入小计 16=11+12+13+14+15
        val[19].column3 = sumL3 / 10000;
        val[19].column4 = sumR3 / 10000;
        // 投资活动现金流出小计 21=17+18+19+20
        val[24].column3 = sumL4 / 10000;
        val[24].column4 = sumR4 / 10000;
        // 投资活动产生的现金流量净额 22=16-21
        val[25].column3 = (sumL3 - sumL4) / 10000;
        val[25].column4 = (sumR3 - sumR4) / 10000;
        // 筹资活动现金流入小计 26=23+24+25
        val[30].column3 = sumL5 / 10000;
        val[30].column4 = sumR5 / 10000;
        // 筹资活动现金流出小计 30=27+28+29
        val[34].column3 = sumL6 / 10000;
        val[34].column4 = sumR6 / 10000;
        // 筹资活动产生的现金流量净额 31=26-30
        val[35].column3 = (sumL5 - sumL6) / 10000;
        val[35].column4 = (sumR5 - sumR6) / 10000;
        // 现金及现金等价物净增加额 33=10+22+31+32
        val[37].column3 = (val[12].column3 * 10000 + val[25].column3 * 10000 + val[35].column3 * 10000 + val[36].column3 * 10000) / 10000;
        val[37].column4 = (val[12].column4 * 10000 + val[25].column4 * 10000 + val[35].column4 * 10000 + val[36].column4 * 10000) / 10000;
        // 期末现金及现金等价物余额 35=33+34
        val[39].column3 = (val[37].column3 * 10000 + val[38].column3 * 10000) / 10000;
        val[39].column4 = (val[37].column4 * 10000 + val[38].column4 * 10000) / 10000;
        // 保存提交的数据
        this.saveData = {
          reportYear: this.year, // 提报年度
          reportMonth: this.month, // 提报月度

          // 销售商品、提供劳务收到的现金
          bqxssptglwsddxj: val[3].column3,
          bnxssptglwsddxj: val[3].column4,
          // 收到的税费返还
          bqsddsffh: val[4].column3,
          bnsddsffh: val[4].column3,
          // 收到其他与经营活动有关的现金
          bqsdqtyjyhdxgdxj: val[5].column3,
          bnsdqtyjyhdxgdxj: val[5].column4,
          // 经营活动现金流入小计
          bqjyhdxjlrxj: val[6].column3,
          bnjyhdxjlrxj: val[6].column4,
          // 购买商品、接受劳务支付的现金
          bqgmspjslwzfdxj: val[7].column3,
          bngmspjslwzfdxj: val[7].column4,
          // 支付给职工以及为职工支付的现金
          bqzfgzgyjwzgzfdxj: val[8].column3,
          bnzfgzgyjwzgzfdxj: val[8].column4,
          // 支付的各项税费
          bqzfdgxsf: val[9].column3,
          bnzfdgxsf: val[9].column4,
          // 支付其他与经营活动有关的现金
          bqzfqtyjyhdxgdxj: val[10].column3,
          bnzfqtyjyhdxgdxj: val[10].column4,
          // 经营活动现金流出小计
          bqjyhdxjlcxj: val[11].column3,
          bnjyhdxjlcxj: val[11].column4,
          // 经营活动产生的现金流量净额
          bqjyhdcsdxjllje: val[12].column3,
          bnjyhdcsdxjllje: val[12].column4,
          // 收回投资收到的现金
          bqshtzsddxj: val[14].column3,
          bnshtzsddxj: val[14].column4,
          // 取得投资收益收到的现金
          bqqdtzsysddxj: val[15].column3,
          bnqdtzsysddxj: val[15].column4,
          // 处置固定资产、无形资产和其他长期资产收回的现金净额
          bqczgdzcwxzcdqtcqzcshdxjje: val[16].column3,
          bnczgdzcwxzchqtcqzcshdxjje: val[16].column4,
          // 处置子公司及其他营业单位收到的现金净额
          bqczzgsjqtyydwsddxjje: val[17].column3,
          bnczzgsjqtyydwsddxjje: val[17].column4,
          // 收到其他与投资活动有关的现金
          bqsdqtytzhdygdxj: val[18].column3,
          bnsdqtytzhdygdxj: val[18].column4,
          // 投资活动现金流入小计
          bqtzhdxjlrxj: val[19].column3,
          bntzhdxjlrxj: val[19].column4,
          // 购建固定资产、无形资产和其他长期资产支付的现金
          bqgjgdzcwxzchqtcqzczfdxj: val[20].column3,
          bngjgdzcwxzchqtcqzczfdxj: val[20].column4,
          // 投资支付的现金
          bqtzzfdxj: val[21].column3,
          bntzzfdxj: val[21].column4,
          // 取得子公司及其他营业单位支付的现金净额
          bqqdzgsjqtyydwzfdxjje: val[22].column3,
          bnqdzgsjqtyydwzfdxjje: val[22].column4,
          // 支付其他与投资活动有关的现金
          bqzfqtytzhdygdxj: val[23].column3,
          bnzfqtytzhdygdxj: val[23].column4,
          // 投资活动现金流出小计
          bqtzhdxjlcxj: val[24].column3,
          bntzhdxjlcxj: val[24].column4,
          // 投资活动产生的现金流量净额
          bqtzhdcsdxjllje: val[25].column3,
          bntzhdcsdxjllje: val[25].column4,
          // 吸收投资收到的现金
          bqxstzsddxj: val[27].column3,
          bnxstzsddxj: val[27].column4,
          // 取得借款收到的现金
          bqqdjksddxj: val[28].column3,
          bnqdjksddxj: val[28].column4,
          // 收到其他与筹资活动有关的现金
          bqsdqtyczhdygdxj: val[29].column3,
          bnsdqtyczhdygdxj: val[29].column4,
          // 筹资活动现金流入小计
          bqczhdxjlrxj: val[30].column3,
          bnczhdxjlrxj: val[30].column4,
          // 偿还债务支付的现金
          bqchzwzfdxj: val[31].column3,
          bnchzwzfdxj: val[31].column4,
          // 分配股利、利润或偿付利息支付的现金
          bqfpgllrhcflxzfdxj: val[32].column3,
          bnfpgllrhcflxzfdxj: val[32].column4,
          // 支付其他与筹资活动有关的现金
          bqzfqtyczhdxgdxj: val[33].column3,
          bnzfqtyczhdxgdxj: val[33].column4,
          // 筹资活动现金流出小计
          bqczhdxjlcxj: val[34].column3,
          bnczhdxjlcxj: val[34].column4,
          // 筹资活动产生的现金流量净额
          bqczhdcsdxjllje: val[35].column3,
          bnczhdcsdxjllje: val[35].column4,
          // 四、汇率变动对现金及现金等价物的影响
          bqhlbddxjjxjdjwdyx: val[36].column3,
          bnhlbddxjjxjdjwdyx: val[36].column4,
          // 五、现金及现金等价物净增加额
          bqxjjxjdjwjzje: val[37].column3,
          bnxjjxjdjwjzje: val[37].column4,
          // 加：期初现金及现金等价物余额
          bqqcxjjxjdjwye: val[38].column3,
          bnqcxjjxjdjwye: val[38].column4,
          // 六、期末现金及现金等价物余额
          bqqmxjjxjdjwye: val[39].column3,
          bnqmxjjxjdjwye: val[39].column4
        };
      }
      console.log(val, this.saveData, '---奥利给---');
    },
    collapseHandle() {
      this.$nextTick(() => {
        this.BaseTable.EXECUTE_RESET_HEIGHT();
      });
    },
    changeHandle(params) {
      this.year = params.yearMonth.split('-')[0];
      this.month = params.yearMonth.split('-')[1];

      this.getList(this.year, this.month);
      this.columns[3].title = `月度：${this.year}年${this.month}月`;
    },
    resetChange(params) {
      this.year = params.yearMonth.split('-')[0];
      this.month = params.yearMonth.split('-')[1];

      this.getList(this.year, this.month);
      this.columns[3].title = `月度：${this.year}年${this.month}月`;
    },
    // 导入
    importHandle() {
      this.isImport = true;
      this.formData.name = '现金流量表导入';
      this.formData.upUrl = 'https://bjev-cms-oss-public.oss-cn-beijing.aliyuncs.com/现金流量表导入.xlsx';
      this.formData.importUrl = '/api/cmscloud.wholesales/cashFlow/upload';
    },
    emitCloseHandler(val, type) {
      this.isImport = val;
      if (type === 'refresh') {
        // 重新加载
        this.getList(this.year, this.month);
      }
    },
    // 表单数据
    formChangeHandle(val) {
      this.saveData = Object.assign({}, this.saveData, val);
    },
    // 保存提交
    async dataHandle(status) {
      if (this.BaseTable.GET_REQUIRED_ERROR() != null) return;

      this.saveData.id = this.reportId ? this.reportId : ''; // Id
      this.saveData.cashFlowStatus = status; // 状态
      this.saveData.checkDesc = this.formList[0].initialValue;

      const res = await saveOne(this.saveData);
      if (res.resultCode == 200) {
        this.$notify.success({ title: '提示信息', message: '操作成功' });
        this.getList(this.year, this.month);
      }
    },
    // 查询列表
    async getList(Year = '', Month = '') {
      this.exportLoading = true;
      const res = await queryList({ reportYear: Year, reportMonth: Month });
      this.reportId = '';
      this.tableList = [];
      this.formList[0].initialValue = '';
      if (res.resultCode == 200) {
        if (res.data) {
          const data = res.data; // 表格

          this.reportId = data.id; // 导出传id
          this.currStatus = this.createDictText(data.cashFlowStatus, '6080');

          this.tableList = [
            {
              column1: '编制单位:',
              column2: data.dealerCode,
              column3: data.dealerName,
              column4: '单位：元'
            },
            {
              column1: '项    目',
              column2: '行次',
              column3: '本月数',
              column4: '本年累计数'
            },
            {
              column1: '一、经营活动产生的现金流量：',
              column2: '',
              column3: '',
              column4: ''
            },
            {
              column1: '销售商品、提供劳务收到的现金',
              column2: '1',
              column3: data.bqxssptglwsddxj,
              column4: data.bnxssptglwsddxj
            },
            {
              column1: '收到的税费返还',
              column2: '2',
              column3: data.bqsddsffh,
              column4: data.bnsddsffh
            },
            {
              column1: '收到其他与经营活动有关的现金',
              column2: '3',
              column3: data.bqsdqtyjyhdxgdxj,
              column4: data.bnsdqtyjyhdxgdxj
            },
            {
              column1: '经营活动现金流入小计',
              column2: '4=1+2+3',
              column3: data.bqjyhdxjlrxj,
              column4: data.bnjyhdxjlrxj
            },
            {
              column1: '购买商品、接受劳务支付的现金',
              column2: '5',
              column3: data.bqgmspjslwzfdxj,
              column4: data.bngmspjslwzfdxj
            },
            {
              column1: '支付给职工以及为职工支付的现金',
              column2: '6',
              column3: data.bqzfgzgyjwzgzfdxj,
              column4: data.bnzfgzgyjwzgzfdxj
            },
            {
              column1: '支付的各项税费',
              column2: '7',
              column3: data.bqzfdgxsf,
              column4: data.bnzfdgxsf
            },
            {
              column1: '支付其他与经营活动有关的现金',
              column2: '8',
              column3: data.bqzfqtyjyhdxgdxj,
              column4: data.bnzfqtyjyhdxgdxj
            },
            {
              column1: '经营活动现金流出小计',
              column2: '9=5+6+7+8',
              column3: data.bqjyhdxjlcxj,
              column4: data.bnjyhdxjlcxj
            },
            {
              column1: '经营活动产生的现金流量净额',
              column2: '10=4-9',
              column3: data.bqjyhdcsdxjllje,
              column4: data.bnjyhdcsdxjllje
            },
            {
              column1: '二、投资活动产生的现金流量：',
              column2: '',
              column3: '',
              column4: ''
            },
            {
              column1: '收回投资收到的现金',
              column2: '11',
              column3: data.bqshtzsddxj,
              column4: data.bnshtzsddxj
            },
            {
              column1: '取得投资收益收到的现金',
              column2: '12',
              column3: data.bqqdtzsysddxj,
              column4: data.bnqdtzsysddxj
            },
            {
              column1: '处置固定资产、无形资产和其他长期资产收回的现金净额',
              column2: '13',
              column3: data.bqczgdzcwxzcdqtcqzcshdxjje,
              column4: data.bnczgdzcwxzchqtcqzcshdxjje
            },
            {
              column1: '处置子公司及其他营业单位收到的现金净额',
              column2: '14',
              column3: data.bqczzgsjqtyydwsddxjje,
              column4: data.bnczzgsjqtyydwsddxjje
            },
            {
              column1: '收到其他与投资活动有关的现金',
              column2: '15',
              column3: data.bqsdqtytzhdygdxj,
              column4: data.bnsdqtytzhdygdxj
            },
            {
              column1: '投资活动现金流入小计',
              column2: '16=11+12+13+14+15',
              column3: data.bqtzhdxjlrxj,
              column4: data.bntzhdxjlrxj
            },
            {
              column1: '购建固定资产、无形资产和其他长期资产支付的现金',
              column2: '17',
              column3: data.bqgjgdzcwxzchqtcqzczfdxj,
              column4: data.bngjgdzcwxzchqtcqzczfdxj
            },
            {
              column1: '投资支付的现金',
              column2: '18',
              column3: data.bqtzzfdxj,
              column4: data.bntzzfdxj
            },
            {
              column1: '取得子公司及其他营业单位支付的现金净额',
              column2: '19',
              column3: data.bqqdzgsjqtyydwzfdxjje,
              column4: data.bnqdzgsjqtyydwzfdxjje
            },
            {
              column1: '支付其他与投资活动有关的现金',
              column2: '20',
              column3: data.bqzfqtytzhdygdxj,
              column4: data.bnzfqtytzhdygdxj
            },
            {
              column1: '投资活动现金流出小计',
              column2: '21=17+18+19+20',
              column3: data.bqtzhdxjlcxj,
              column4: data.bntzhdxjlcxj
            },
            {
              column1: '投资活动产生的现金流量净额',
              column2: '22=16-21',
              column3: data.bqtzhdcsdxjllje,
              column4: data.bntzhdcsdxjllje
            },
            {
              column1: '三、筹资活动产生的现金流量：',
              column2: '',
              column3: '',
              column4: ''
            },
            {
              column1: '吸收投资收到的现金',
              column2: '23',
              column3: data.bqxstzsddxj,
              column4: data.bnxstzsddxj
            },
            {
              column1: '取得借款收到的现金',
              column2: '24',
              column3: data.bqqdjksddxj,
              column4: data.bnqdjksddxj
            },
            {
              column1: '收到其他与筹资活动有关的现金',
              column2: '25',
              column3: data.bqsdqtyczhdygdxj,
              column4: data.bnsdqtyczhdygdxj
            },
            {
              column1: '筹资活动现金流入小计',
              column2: '26=23+24+25',
              column3: data.bqczhdxjlrxj,
              column4: data.bnczhdxjlrxj
            },
            {
              column1: '偿还债务支付的现金',
              column2: '27',
              column3: data.bqchzwzfdxj,
              column4: data.bnchzwzfdxj
            },
            {
              column1: '分配股利、利润或偿付利息支付的现金',
              column2: '28',
              column3: data.bqfpgllrhcflxzfdxj,
              column4: data.bnfpgllrhcflxzfdxj
            },
            {
              column1: '支付其他与筹资活动有关的现金',
              column2: '29',
              column3: data.bqzfqtyczhdxgdxj,
              column4: data.bnzfqtyczhdxgdxj
            },
            {
              column1: '筹资活动现金流出小计',
              column2: '30=27+28+29',
              column3: data.bqczhdxjlcxj,
              column4: data.bnczhdxjlcxj
            },
            {
              column1: '筹资活动产生的现金流量净额',
              column2: '31=26-30',
              column3: data.bqczhdcsdxjllje,
              column4: data.bnczhdcsdxjllje
            },
            {
              column1: '四、汇率变动对现金及现金等价物的影响',
              column2: '32',
              column3: data.bqhlbddxjjxjdjwdyx,
              column4: data.bnhlbddxjjxjdjwdyx
            },
            {
              column1: '五、现金及现金等价物净增加额',
              column2: '33=10+22+31+32',
              column3: data.bqxjjxjdjwjzje,
              column4: data.bnxjjxjdjwjzje
            },
            {
              column1: '加：期初现金及现金等价物余额',
              column2: '34=资产负债表中行次1“货币资金”的期初余额',
              column3: data.bqqcxjjxjdjwye,
              column4: data.bnqcxjjxjdjwye
            },
            {
              column1: '六、期末现金及现金等价物余额',
              column2: '35=33+34=资产负债表中行次1“货币资金”的期末余额（校验）',
              column3: data.bqqmxjjxjdjwye,
              column4: data.bnqmxjjxjdjwye,
              checkStatus: data.checkStatus
            }
          ];
          // 驳回意见赋值
          this.formList[0].initialValue = data.checkDesc;
          if (60801002 == data.cashFlowStatus) {
            this.isShow = false; // 已提交数据不展示按钮
            this.columns.map(x => {
              x.editable = false;
            });
          } else {
            this.isShow = true; // 未提交数据展示按钮
            this.columns.map(x => {
              x.editable = true;
            });
          }
        } else {
          this.isShow = true; // 未提交数据展示按钮
          this.currStatus = '';
          this.columns.map(x => {
            x.editable = true;
          });

          this.tableList = [
            {
              column1: '编制单位:',
              column2: getOwnerCode(),
              column3: this.dealerName,
              column4: '单位：元'
            },
            {
              column1: '项    目',
              column2: '行次',
              column3: '本月数',
              column4: '本年累计数'
            },
            {
              column1: '一、经营活动产生的现金流量：',
              column2: '',
              column3: '',
              column4: ''
            },
            {
              column1: '销售商品、提供劳务收到的现金',
              column2: '1',
              column3: 0,
              column4: 0
            },
            {
              column1: '收到的税费返还',
              column2: '2',
              column3: 0,
              column4: 0
            },
            {
              column1: '收到其他与经营活动有关的现金',
              column2: '3',
              column3: 0,
              column4: 0
            },
            {
              column1: '经营活动现金流入小计',
              column2: '4=1+2+3',
              column3: 0,
              column4: 0
            },
            {
              column1: '购买商品、接受劳务支付的现金',
              column2: '5',
              column3: 0,
              column4: 0
            },
            {
              column1: '支付给职工以及为职工支付的现金',
              column2: '6',
              column3: 0,
              column4: 0
            },
            {
              column1: '支付的各项税费',
              column2: '7',
              column3: 0,
              column4: 0
            },
            {
              column1: '支付其他与经营活动有关的现金',
              column2: '8',
              column3: 0,
              column4: 0
            },
            {
              column1: '经营活动现金流出小计',
              column2: '9=5+6+7+8',
              column3: 0,
              column4: 0
            },
            {
              column1: '经营活动产生的现金流量净额',
              column2: '10=4-9',
              column3: 0,
              column4: 0
            },
            {
              column1: '二、投资活动产生的现金流量：',
              column2: '',
              column3: '',
              column4: ''
            },
            {
              column1: '收回投资收到的现金',
              column2: '11',
              column3: 0,
              column4: 0
            },
            {
              column1: '取得投资收益收到的现金',
              column2: '12',
              column3: 0,
              column4: 0
            },
            {
              column1: '处置固定资产、无形资产和其他长期资产收回的现金净额',
              column2: '13',
              column3: 0,
              column4: 0
            },
            {
              column1: '处置子公司及其他营业单位收到的现金净额',
              column2: '14',
              column3: 0,
              column4: 0
            },
            {
              column1: '收到其他与投资活动有关的现金',
              column2: '15',
              column3: 0,
              column4: 0
            },
            {
              column1: '投资活动现金流入小计',
              column2: '16=11+12+13+14+15',
              column3: 0,
              column4: 0
            },
            {
              column1: '购建固定资产、无形资产和其他长期资产支付的现金',
              column2: '17',
              column3: 0,
              column4: 0
            },
            {
              column1: '投资支付的现金',
              column2: '18',
              column3: 0,
              column4: 0
            },
            {
              column1: '取得子公司及其他营业单位支付的现金净额',
              column2: '19',
              column3: 0,
              column4: 0
            },
            {
              column1: '支付其他与投资活动有关的现金',
              column2: '20',
              column3: 0,
              column4: 0
            },
            {
              column1: '投资活动现金流出小计',
              column2: '21=17+18+19+20',
              column3: 0,
              column4: 0
            },
            {
              column1: '投资活动产生的现金流量净额',
              column2: '22=16-21',
              column3: 0,
              column4: 0
            },
            {
              column1: '三、筹资活动产生的现金流量：',
              column2: '',
              column3: '',
              column4: ''
            },
            {
              column1: '吸收投资收到的现金',
              column2: '23',
              column3: 0,
              column4: 0
            },
            {
              column1: '取得借款收到的现金',
              column2: '24',
              column3: 0,
              column4: 0
            },
            {
              column1: '收到其他与筹资活动有关的现金',
              column2: '25',
              column3: 0,
              column4: 0
            },
            {
              column1: '筹资活动现金流入小计',
              column2: '26=23+24+25',
              column3: 0,
              column4: 0
            },
            {
              column1: '偿还债务支付的现金',
              column2: '27',
              column3: 0,
              column4: 0
            },
            {
              column1: '分配股利、利润或偿付利息支付的现金',
              column2: '28',
              column3: 0,
              column4: 0
            },
            {
              column1: '支付其他与筹资活动有关的现金',
              column2: '29',
              column3: 0,
              column4: 0
            },
            {
              column1: '筹资活动现金流出小计',
              column2: '30=27+28+29',
              column3: 0,
              column4: 0
            },
            {
              column1: '筹资活动产生的现金流量净额',
              column2: '31=26-30',
              column3: 0,
              column4: 0
            },
            {
              column1: '四、汇率变动对现金及现金等价物的影响',
              column2: '32',
              column3: 0,
              column4: 0
            },
            {
              column1: '五、现金及现金等价物净增加额',
              column2: '33=10+22+31+32',
              column3: 0,
              column4: 0
            },
            {
              column1: '加：期初现金及现金等价物余额',
              column2: '34=资产负债表中行次1“货币资金”的期初余额',
              column3: 0,
              column4: 0
            },
            {
              column1: '六、期末现金及现金等价物余额',
              column2: '35=33+34=资产负债表中行次1“货币资金”的期末余额（校验）',
              column3: 0,
              column4: 0
            }
          ];
        }
      }else{
        this.currStatus = '';
      }
      this.exportLoading = false;
    },
    // 导出
    async exportHandle() {
      await this.$confirm('是否将Excel表格保存至本地文件夹?', '提示', {
        confirmButtonText: '下载',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          this.exportLoading = true;
          let param = { id: this.reportId };
          exportExcel(param)
            .then(response => {
              exportExcelFile(response.data, '现金流量表提报');
              this.exportLoading = false;
            })
            .catch(err => {
              console.log(err);
            });
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });
        });
    },

    createdFrom() {
      return [
        {
          type: 'DATE',
          label: '月度',
          fieldName: 'yearMonth',
          dateType: 'month',
          initialValue: moment().format('YYYY-MM'),
          placeholder: '请选择'
        }
      ];
    },
    createdFrom1() {
      return [
        {
          type: 'TEXT_AREA',
          label: '驳回意见',
          fieldName: 'checkDesc',
          initialValue: '',
          selfCols: 3,
          placeholder: '',
          disabled: true
        }
      ];
    },
    createdTable() {
      return [
        {
          title: '现金流量表',
          dataIndex: 'column1',
          filterType: 'input',
          align: 'center'
        },
        {
          title: '',
          dataIndex: 'column2',
          filterType: 'input',
          align: 'center'
        },
        {
          title: '',
          dataIndex: 'column3',
          filterType: 'input',
          align: 'center',
          showOverflowTooltip: false,
          editType: 'number',
          defaultEditable: true,
          editable: true,
          editRequired: true,
          msgtitle: '当前项',
          max: 999999999,
          min: -999999999
        },
        {
          title: `月度：${moment().format('YYYY')}年${moment().format('MM')}月`,
          dataIndex: 'column4',
          filterType: 'input',
          align: 'center',
          showOverflowTooltip: false,
          editType: 'number',
          defaultEditable: true,
          editable: true,
          editRequired: true,
          msgtitle: '当前项',
          max: 999999999,
          min: -999999999
        }
      ];
    }
  }
};
</script>
